package com.chat.business.controller;

import com.chat.business.service.IFileService;
import com.chat.common.vo.R;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件管理
 *
 * @author wei kunJie
 * @date 2024/5/24 14:53:03
 */
@RestController
@RequestMapping("/business/file")
public class FileController {
    @Resource
    private IFileService fileService;

    /**
     * 上传图片
     * 上传图片，返回url
     * @param imageFile
     * @param request
     * @return
     */
    @PostMapping("/uploadImage")
    public R<String> uploadImage(MultipartFile imageFile, HttpServletRequest request){
        return  fileService.uploadImage(imageFile,request);
    }
}
